package cnhy.salary.domain.dto;

import com.easy.query.core.annotation.EasyWhereCondition;
import com.easy.query.core.annotation.Table;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.var;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Objects;

@Data
@Table("v_attendance_list")
public class AttendanceMaxDto  {



   static LinkedHashMap<Integer,String> map;

    /** 过期状态对于描述
     *
     * @return
     */
    public String getDayLabel(){
        var res=getResultExt();
        if(!StringUtils.isBlank(getLeaveType()))
            res= Objects.equals(getLeaveType(), "1") ?21:20;
        if(map==null)
        {
            map=new LinkedHashMap<Integer,String>();
            map.put(0,"正常");
            map.put(1,"迟到");
            map.put(2,"缺卡");
            map.put(10,"补卡");
            map.put(20,"事假");
            map.put(21,"病假");
        }
        if(!map.containsKey(res)){
            return "";
        }
        return map.get(res);
    }

    /** 获取归属日期格式化后的字符串
     *
     * @return
     */
    public String getDateStrFmt() {
        return StringUtils.isBlank(getDateFmt()) ? getLeaveDate() : getDateFmt();
    }
    //
    @ApiModelProperty(value = "请假数据id",notes = "")
    Long leaveId;
    @ApiModelProperty(value = "请假user_id",notes = "")
    Long leaveUser;
    @ApiModelProperty(value = "请假归属日格式化",notes = "")
    String leaveDate;

    @ApiModelProperty(value = "请假类型",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    String leaveType;

    @ApiModelProperty(value = "考勤结果",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    Double leaveDuration;



    //
    /**  */
    @ApiModelProperty(value = "",notes = "")
    private Long userId ;
    @ApiModelProperty(value = "考勤归属日格式化",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.LIKE_MATCH_LEFT)
    String dateFmt;
    @ApiModelProperty(value = "考勤归属日期",notes = "")
    Date dayDate;
    /**  */
    @ApiModelProperty(value = "",notes = "")
    private String userName ;


    /** 首次打卡 */
    @ApiModelProperty(value = "首次打卡",notes = "")
    private Date firstTime ;


    /** 末次打卡 */
    @ApiModelProperty(value = "末次打卡",notes = "")
    private Date lastTime ;


    /** 0正常、1迟到、2缺卡 */
    @ApiModelProperty(value = "0正常、1迟到、2缺卡",notes = "")
    private Integer result ;


    /** 0正常、1迟到、2缺卡,10补卡、20请假 */
    @ApiModelProperty(value = "0正常、1迟到、2缺卡,10补卡、20请假",notes = "")
    private Integer resultExt ;


    /** 记录来源标记 */
    @ApiModelProperty(value = "记录来源标记",notes = "")
    private String source ;


    /** 创建人 */
    @ApiModelProperty(value = "创建人",notes = "")
    private Long createdId ;


    /** 创建时间 */
    @ApiModelProperty(value = "创建时间",notes = "")
    private Date createdTime ;
}
